package com.example.gzysmartcity.ui.adapter;

import android.util.Log;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.gzysmartcity.R;
import com.example.gzysmartcity.repository.model.Commodity;

import org.jetbrains.annotations.NotNull;

public class SellRvAdatper extends BaseQuickAdapter<Commodity.DataBean, BaseViewHolder> {
    public SellRvAdatper(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, Commodity.DataBean dataBean) {
        baseViewHolder.setText(R.id.tv_sell_sell, "已售" + dataBean.getVolume() + "件");
        ImageView imageView = baseViewHolder.getView(R.id.image_rv_sell);
        Glide.with(imageView.getContext()).load(dataBean.getPic()).into(imageView);
        String nows = dataBean.getCommodityName();
        String newStr = nows.replaceAll(" ", "\n");
        baseViewHolder.setText(R.id.rv_sell_name, newStr);
        baseViewHolder.setText(R.id.rv_sell_money, dataBean.getMoney());

    }
}
